UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W6s4SRYPBzg5qgPhO1bRsIWLVH14XxLznPfIJZGu5gE='
WHERE
key_id = '6d7ba3897d88324c05ee52641d118a48ea93a9eff434788bbf07d01532eb3cde'
AND (
token = 'W6s4SRYPBzg5qgPhO1bRsIWLVH14XxLznPfIJZGu5gE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)