UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5f5T6pRk51/6T9X3iYzu7g6HTaeTWmgwlkUOqfflqH8='
WHERE
key_id = 'dc4f44365097a56dd804963b46127c603687585e2b0d2d04be08f4881ec9ffe7'
AND (
token = '5f5T6pRk51/6T9X3iYzu7g6HTaeTWmgwlkUOqfflqH8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)