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

Query time 0.00030