UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lCyO52q2zDPhtFgW6OSYjN62yDPEuRJKoxW3gP0GTxM='
WHERE
key_id = 'd7325fd8a3da6dd2a57b83dc5b1414468846eb2ae0f8ed276decfd815af50de3'
AND (
token = 'lCyO52q2zDPhtFgW6OSYjN62yDPEuRJKoxW3gP0GTxM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)