UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '46dnc8cUaPuoU1tj8dASgigNtc/DKT3msc84NH3NsAA='
WHERE
key_id = 'a2e0965a033e99bfcf059a69234b787c4c369e8d8f56dd1232f8e8c384fb87af'
AND (
token = '46dnc8cUaPuoU1tj8dASgigNtc/DKT3msc84NH3NsAA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)