UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ubEz0EfUeIhPjyPgGWDSjhcTrpqIH8y4viGyJaszRdY=' 
WHERE 
  key_id = '6bed232a90f4f5ee1c4bc4a061395a235e721b72eebf438ac06a9406027bc31d' 
  AND (
    token = 'ubEz0EfUeIhPjyPgGWDSjhcTrpqIH8y4viGyJaszRdY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057