UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rmGEYCnK4WqnCV6nHrxLfORpr3Nql+BPVlf7NsdQwu8=' 
WHERE 
  key_id = '3f65c063f5f6676c3be4b5b5fdcfa143ff1c736940e6057b13fcbaee5526474b' 
  AND (
    token = 'rmGEYCnK4WqnCV6nHrxLfORpr3Nql+BPVlf7NsdQwu8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020