UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qd8EojNTC3uIVGQAH1UBbTxrFjCXXeEs/Ge74vawYvc='
WHERE
key_id = '27a8c3bff5f6677d055c91480b8c3ca04ad523c2a610f99a5e891741b4f3afa8'
AND (
token = 'Qd8EojNTC3uIVGQAH1UBbTxrFjCXXeEs/Ge74vawYvc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)