UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tk9gaSzj+1K3O9WOJUJYxos1t/YoshxBU7Wp6/Brujg=' 
WHERE 
  key_id = '84e6bf938fbfbd107abd11d607e096da7779b1390722a02f81a7ccafc56da018' 
  AND (
    token = 'Tk9gaSzj+1K3O9WOJUJYxos1t/YoshxBU7Wp6/Brujg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023