UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r/ZD44XfkM0U6v29w0Pv03aWk/5FpNB8TUlki4u7Xg4='
WHERE
key_id = '9f01912853bef3cddb36e1702bfb573fe905baba247a1b72067b3f2cada5bc2c'
AND (
token = 'r/ZD44XfkM0U6v29w0Pv03aWk/5FpNB8TUlki4u7Xg4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)