UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4LkDvhwprVagZCRPfNtO9j8M1+6aCGzhMy1ZHG0nHiA='
WHERE
key_id = '6db49826a85c2ea75397db0394a0aa82531842554a9eb634d0163430640d8a58'
AND (
token = '4LkDvhwprVagZCRPfNtO9j8M1+6aCGzhMy1ZHG0nHiA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)