UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5pvg4nVuBKrdNzyLyBTU6i4viavI32wjh3G62QrlHp0=' 
WHERE 
  key_id = '7ef5464edb157af2db8a32bd424343a1613c35162fe82d3921e2116670077a71' 
  AND (
    token = '5pvg4nVuBKrdNzyLyBTU6i4viavI32wjh3G62QrlHp0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023