UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bne/YIUC5LLWRoeRO9lYOnFdr5fMrjUeyCcdSX631d8='
WHERE
key_id = 'e45451544f75eaf44af96563a9aed0774777de232ded0fb70b0b4da8d78ef6a6'
AND (
token = 'bne/YIUC5LLWRoeRO9lYOnFdr5fMrjUeyCcdSX631d8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)