UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X41Ya+fEYdSUlYSc0bVH7uh4gKuC+By3twcrcEUaJ/s='
WHERE
key_id = 'e352ee877da3e58270f17a9cd0695463ac87976d2c103a2370d642b555a2c4c4'
AND (
token = 'X41Ya+fEYdSUlYSc0bVH7uh4gKuC+By3twcrcEUaJ/s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)