UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0lnD+kCMUkDBYPF1G59J+5ZOFZjPGVZN8Emq2wRDle4='
WHERE
key_id = '02ebbba1bffe68284867242d3959014a0a2e1e43fab2340f056b2159dbf4e7c3'
AND (
token = '0lnD+kCMUkDBYPF1G59J+5ZOFZjPGVZN8Emq2wRDle4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)