UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n8y0MyS6HwDpifPQdmsO8U3c42//LoSG5Jkb5fQrZsU=' 
WHERE 
  key_id = '45ee54964d2d29585464a7c51a1b70ab9d06622369d3b9ec56d06e9ac87ade19' 
  AND (
    token = 'n8y0MyS6HwDpifPQdmsO8U3c42//LoSG5Jkb5fQrZsU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030