UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S9czPF/udjoE9BeY+485noLdqGMGSyug1jRy2y1ml2s='
WHERE
key_id = '48f4a5690880fbd01ec807c23c518355d8dffe7852af1a2f7ba2dbe3dd459497'
AND (
token = 'S9czPF/udjoE9BeY+485noLdqGMGSyug1jRy2y1ml2s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)