UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qvB5AOItLQmaaUNyfK0jJy2HucRHfsU+4wCgozy1GUk='
WHERE
key_id = '04cbe9c5339f5f75bc8480668bb59468a4138bac8bad75c4740a135906bc30f9'
AND (
token = 'qvB5AOItLQmaaUNyfK0jJy2HucRHfsU+4wCgozy1GUk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)