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

Query time 0.00059