UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P0W1rdTCrOtq6+34IxAOErIjs9whaCzO0qhgOC/fatA=' 
WHERE 
  key_id = '5fbebecbe1e345781294f80bda46cd51505af63330fec44e74aaab30edd414b6' 
  AND (
    token = 'P0W1rdTCrOtq6+34IxAOErIjs9whaCzO0qhgOC/fatA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030