UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2H2fLA4KfMAJL8zJmvdc8y2SMAFzx4sdACi2JHdJ7Gg='
WHERE
key_id = 'e9edca1cde814849eaf73e1b3b651759a26b22b22a7e2f054937120e5a3e91a7'
AND (
token = '2H2fLA4KfMAJL8zJmvdc8y2SMAFzx4sdACi2JHdJ7Gg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)