UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cDQcHCmSWdtywmdp2Q84bF2JxRdmmQip2dpbFGE9PpI='
WHERE
key_id = '6d89947e077ddf3588ce911b6f7a57a242558d81cd18d7113eb74061014b788d'
AND (
token = 'cDQcHCmSWdtywmdp2Q84bF2JxRdmmQip2dpbFGE9PpI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)