UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'brirBJTA6EfGSOBFKo/XoHFTrtG/kXAG8IUVJV0pYQc='
WHERE
key_id = 'd166e562fe1d1a35302159014eabe1d70ed4b5b7059922b3a3de5e5a7ceefcd4'
AND (
token = 'brirBJTA6EfGSOBFKo/XoHFTrtG/kXAG8IUVJV0pYQc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)