UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mLdnstlieaZ6KwG1E6ZtgU7+IZ/tamvR/MTyaC1aLpk=' 
WHERE 
  key_id = '649ba37c97d3f481d75f275a90ad07be1106a20a940c3c93fada4b30cac67460' 
  AND (
    token = 'mLdnstlieaZ6KwG1E6ZtgU7+IZ/tamvR/MTyaC1aLpk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037