UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dhy1AjWDX61YISkS/1NER0zmzkLCjBzQnE4Zrm9if2Y='
WHERE
key_id = 'd433de6080ce774563be9a53f9bbb9c16f0a8023f216061f953d2e8db08ba5b7'
AND (
token = 'dhy1AjWDX61YISkS/1NER0zmzkLCjBzQnE4Zrm9if2Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)