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