UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l2IRGOkYpuEDAL9j7FmBnjzZ4r5Go5mXesHIK+8wLDo=' 
WHERE 
  key_id = '588ab78790f4d1968997f0cfee15c7602c992008780d5e561789fae2f2ff007d' 
  AND (
    token = 'l2IRGOkYpuEDAL9j7FmBnjzZ4r5Go5mXesHIK+8wLDo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030