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

Query time 0.00037