UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DAt4BqBJKcEaVsqAlWuAnEaYpsVzrAaQsBgOFJn7rDM='
WHERE
key_id = 'fbfe5c57d4d137dfc6459e20f2554173d8e127d076d3c2f79537adfcf892ce3c'
AND (
token = 'DAt4BqBJKcEaVsqAlWuAnEaYpsVzrAaQsBgOFJn7rDM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)