UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hidcWnQwgEjSrlC4YeREoSxmqx2POOf3fdECyET1viA='
WHERE
key_id = 'b0af67266d04808d4e0058fcc6d25a7c8c89547b524a23084fe77aa0d414ca75'
AND (
token = 'hidcWnQwgEjSrlC4YeREoSxmqx2POOf3fdECyET1viA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)