UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xYIaQUYenLPAJG9YRVhE1hBGarECKP+g+OVtanGXWsA=' 
WHERE 
  key_id = '658d208702e25adeaeafd663fb0de71d55f6639be55decbd9afd13af3f345c22' 
  AND (
    token = 'xYIaQUYenLPAJG9YRVhE1hBGarECKP+g+OVtanGXWsA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032