UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E3VHvuWAm1BhnwqnPyqLlT0b2jWQF82vEeR/A6ud3cM='
WHERE
key_id = '4078107b7d07e0e119c4ec561464b80e11a3639ebcfbb56c762c7750e8b79816'
AND (
token = 'E3VHvuWAm1BhnwqnPyqLlT0b2jWQF82vEeR/A6ud3cM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)