UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd82eHqgeTZM0Su/iIJ1LdHci3BpO61MB/EVKcvZuvLs='
WHERE
key_id = 'cbbf362d642fafe35aa6ba1ccae56c67ccc187b29eadf8672098ad7d45786829'
AND (
token = 'd82eHqgeTZM0Su/iIJ1LdHci3BpO61MB/EVKcvZuvLs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)