UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y1GpIPgmwDAnbySNw/oFn1BrulQZpAYhqVLxFNTfD94=' 
WHERE 
  key_id = '5becfbe5052cf26650b692b627d4627fe8ab321e737132e62b30e54c3c39fe6c' 
  AND (
    token = 'Y1GpIPgmwDAnbySNw/oFn1BrulQZpAYhqVLxFNTfD94=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028