UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n67oJX32o8pB80+M6Vn6W6I2byTIhPTPRVaKb+xrfow=' 
WHERE 
  key_id = 'bf90ab3504a760b1036360bc5aa2a3c2de14884a42da12396a02c412aff69a44' 
  AND (
    token = 'n67oJX32o8pB80+M6Vn6W6I2byTIhPTPRVaKb+xrfow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037