UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hbKnYESCAmXG9JJXoKxTJ2nV+e3Fsb+zCY8hKGiYP5A=' 
WHERE 
  key_id = '42e14ec3c00a3ad6135254168908d314c2820ee6fed1ad5fe6565bfc4101b39c' 
  AND (
    token = 'hbKnYESCAmXG9JJXoKxTJ2nV+e3Fsb+zCY8hKGiYP5A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022