UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cGi1dooidHEmd6NivzYyREkrLM54ll6zJ+Gs+ASOfJc=' 
WHERE 
  key_id = 'ba2af4d2b653d1ffb49267d653a4f8e52997fb61fa2cd974e6e7652962dbc7e7' 
  AND (
    token = 'cGi1dooidHEmd6NivzYyREkrLM54ll6zJ+Gs+ASOfJc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031