UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uBOId2j5F9JzFUcNUS3iPgfICPG4KUDHS0xjZzsxy1Y=' 
WHERE 
  key_id = 'd19d3debe0983323306909c4a47dfa56966d841df7207a1500de9f80d5877dc1' 
  AND (
    token = 'uBOId2j5F9JzFUcNUS3iPgfICPG4KUDHS0xjZzsxy1Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025