UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RFaXKo40SnHAChYyAZzZ/7JtyRJAJ//Ym7qkw8AGxf0=' 
WHERE 
  key_id = '788eafef67da4f019d83ff690fff947a6b61d30fac150219dc72b2ff169387db' 
  AND (
    token = 'RFaXKo40SnHAChYyAZzZ/7JtyRJAJ//Ym7qkw8AGxf0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025